//
//  UILabel+extension.swift
//  01-启动图片的搭建
//
//  Created by 白利兵 on 15/10/15.
//  Copyright © 2015年 itheima. All rights reserved.
//

import UIKit

extension UILabel{
    convenience init (title: String, fontSize: CGFloat = 14, color: UIColor = UIColor.darkGrayColor(), screenInsets: CGFloat = 0){
        self.init()
            text = title
            font = UIFont.systemFontOfSize(fontSize)
            textColor = color
            numberOfLines = 0
        if  screenInsets == 0 {
            textAlignment = .Center
        }
        else {
            textAlignment = .Left
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.size.width - 2 * screenInsets
        }
        sizeToFit()
    }
}
